from tkinter import *


root = Tk()

root.geometry('800x600')

canvas=Canvas(root,width=200,height=180,scrollregion=(0,0,520,520)) #创建canvas
canvas.place(x = 75, y = 25) #放置canvas的位置
frame=Frame(canvas) #把frame放在canvas里
frame.place(width=180, height=180) #frame的长宽，和canvas差不多的
vbar=Scrollbar(canvas,orient=VERTICAL) #竖直滚动条
vbar.place(x = 180,width=20,height=180)
vbar.configure(command=canvas.yview)
# hbar=Scrollbar(canvas,orient=HORIZONTAL)#水平滚动条
# hbar.place(x =0,y=165,width=180,height=20)
# hbar.configure(command=canvas.xview)
# canvas.config(xscrollcommand=hbar.set,yscrollcommand=vbar.set) #设置
canvas.config(yscrollcommand=vbar.set) #设置
canvas.create_window((90,20), window=frame)  #create_window

Button(frame,text='aa').pack()
Button(frame,text='aa').pack()
Button(frame,text='aa').pack()
Button(frame,text='aa').pack()
Button(frame,text='aa').pack()
Button(frame,text='aa').pack()
root.mainloop()